package me.qingy.dubbo;

import me.qingy.dubbo.bean.Info;
import me.qingy.dubbo.service.ProviderService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author qingy
 * @date 2020-10-03
 */
@EnableDubbo
@SpringBootApplication
public class ConsumerApplication implements CommandLineRunner {
    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

    @DubboReference
    private ProviderService providerService;

    @Override
    public void run(String... args) throws Exception {
        Info infoById = providerService.getInfoById(1L);
        System.out.println("rpc result:" + infoById);
    }
}
